﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace SIG.Web.Models
{
    public static class SIGAuthExtended
    {
        //public static bool HasRole(this ControllerBase controller, string role)
        //{
        //    bool Found = false;
        //    try
        //    {
        //        //Check if the requesting user has the specified role...
        //        Found = new RBACUser(controller.ControllerContext
        //                             .HttpContext.User.Identity.Name).HasRole(role);
        //    }
        //    catch { }
        //    return Found;
        //}

        //public static bool HasRoles(this ControllerBase controller, string roles)
        //{
        //    bool bFound = false;
        //    try
        //    {
        //        //Check if the requesting user has any of the specified roles...
        //        //Make sure you separate the roles using ';' (ie "Sales Manager;Sales Operator")
        //        bFound = new RBACUser(controller.ControllerContext
        //                              .HttpContext.User.Identity.Name).HasRoles(roles);
        //    }
        //    catch { }
        //    return bFound;
        //}

        //public static bool HasPermission(this ControllerBase controller, string permission)
        //{
        //    bool Found = false;
        //    try
        //    {
        //        //Check if the requesting user has the specified application permission...
        //        Found = new RBACUser(controller.ControllerContext
        //                             .HttpContext.User.Identity.Name).HasPermission(permission);
        //    }
        //    catch { }
        //    return Found;
        //}

        //public static bool IsSysAdmin(this ControllerBase controller)
        //{
        //    bool IsSysAdmin = false;
        //    try
        //    {
        //        //Check if the requesting user has the System Administrator privilege...
        //        IsSysAdmin = new RBACUser(controller.ControllerContext
        //                                  .HttpContext.User.Identity.Name).IsSysAdmin;
        //    }
        //    catch { }
        //    return IsSysAdmin;
        //}
    }
}
